<script>
init({
  title: 'Issue #137',
  desc: 'Refresh from url after use data option(<a href="https://github.com/wenzhixin/bootstrap-table/issues/137" target="_blank">#137</a>).',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <div class="toolbar">
    <button
      id="button"
      class="btn btn-secondary"
    >
      Refresh from url
    </button>
  </div>
  <table
    id="table"
    data-toolbar=".toolbar"
  >
    <thead>
      <tr>
        <th data-field="id">
          ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th data-field="price">
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  const $table = $('#table')

  function mounted () {
    $table.bootstrapTable({
      data: [
        {
          id: 0,
          name: 'Item 0',
          price: '$0'
        }
      ]
    })
    $('#button').click(function () {
      $table.bootstrapTable('refresh', { url: 'json/data1.json' })
    })
  }
</script>
